<?php	
function load_gmap_location_options(){
  $sql = 'select o.lid,o.title,o.x,o.y,o.content,o.status from {google_map_location_options} o where o.status =1';
  $query = db_query($sql);
  $result = array();
  while ($row = db_fetch_array($query)) {
    $result[] = $row;
  }
  return $result;
}
function load_gmap_location_all(){
  $sql = 'select o.lid,o.title,o.x,o.y,o.content,o.status from {google_map_location_options} o';
  $query = db_query($sql);
  $result = array();
  while ($row = db_fetch_array($query)) {
    $result[] = $row;
  }
  return $result;
}
function load_gmap_get_location($lid){
  $sql = 'select o.lid,o.title,o.x,o.y,o.content,o.status from {google_map_location_options} o where o.lid=%d';
  $query = db_query($sql,array($lid));
  $result = null;
  while ($row = db_fetch_array($query)) {
    $result = $row;
  }
  return $result;
}
function add_location($title,$x,$y,$content,$status){
  db_query("INSERT INTO {google_map_location_options} (title, x,y, content,status) VALUES ('%s', '%s', '%s','%s',%d)", array(
    $title,$x,$y,$content,$status
  ));
}
function edit_location($lid,$title,$x,$y,$content,$status){
  db_query("UPDATE {google_map_location_options} SET title='%s', x='%s',y='%s', content='%s',status=%d WHERE lid=%d", array(
    $title,$x,$y,$content,$status,$lid
  ));
}
function delete_location($lid){
  db_query("DELETE FROM {google_map_location_options} WHERE lid=%d", array($lid));
}
?>
